package com.leetcode.tree;

/**
 * @Author zhang.xin
 * @Description: TODO(这里描述)
 * @Date 2020/1/2
 */
public class Leetcode104 {

    public int maxDepth(TreeNode root) {
        int left;
        int right;
        int height;

        if (root != null) {
            left = maxDepth(root.left);
            right = maxDepth(root.right);
            height = left > right ? left : right;
            return height + 1;
        }
        return 0;
    }

}
